'use strict';

angular.module('CBO').controller('RoutingListController', ['$scope', 'PublicModule', 'BaseService', 'PublicEnum', '$location', 'Authentication',
    function($scope, PublicModule, BaseService, PublicEnum, $location, Authentication) {
        BaseService.getExtendEnum('ItemCategory', function(extendEnum){
            $scope.ItemCategoryEnum = extendEnum;
        });

    	PublicModule.initModule($scope, 'Routing');
        $scope.Module.Routing.LoadMode = PublicEnum.LoadMode.CacheAndPaging;
        $scope.Module.Routing.PageSize = 15;
        $scope.Module.Routing.Populate = {path: 'ItemMaster', select: 'Name'};

        $scope.btnAdd = function(){
        	$location.url('/index/Routing/Edit');
        };

        $scope.rowDblClick = function(){
            $scope.$apply(function(){
                $location.url("/index/Routing/Edit/" + $scope.Module.Routing.FocusedRecord._id);
            });
        };

        $scope.btnDelete = function(){
        	$scope.Module.Routing.deleteSelecteds();
        };
    }
]);